package com.vhall.component.plugin.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author jingwen.li
 */
@Getter
@AllArgsConstructor
public enum GoodsRiskLevelEnum {
    NO_REQUIREMENT("0", "无要求"),
    R1("1", "R1(低风险)"),
    R2("2", "R2(中低风险)"),
    R3("3", "R3(中风险)"),
    R4("4", "R4(中高风险)"),
    R5("5", "R5(高风险)");

    private final String value;
    private final String name;

    /**
     * 通过 value 获取 name
     * @param value
     * @return
     */
    public static String getNameByValue(String value) {
        for (GoodsRiskLevelEnum e : GoodsRiskLevelEnum.values()) {
            if (e.getValue().equals(value)) {
                return e.getName();
            }
        }
        return null;
    }
}
